GFile *remote_cache_dir;
GFile *config_file;
+ GPtrArray *cached_meta_indexes;
+ GPtrArray *cached_content_indexes;
+
gboolean inited;
gboolean in_transaction;
g_hash_table_destroy (priv->pack_data_mappings);
if (priv->config)
g_key_file_free (priv->config);
+ ot_clear_ptrarray (&priv->cached_meta_indexes);
+ ot_clear_ptrarray (&priv->cached_content_indexes);
G_OBJECT_CLASS (ostree_repo_parent_class)->finalize (object);
}
ot_lptrarray GPtrArray *ret_meta_indexes = NULL;
ot_lptrarray GPtrArray *ret_data_indexes = NULL;
- superindex_path = g_file_get_child (priv->pack_dir, "index");
-
- if (g_file_query_exists (superindex_path, cancellable))
+ if (priv->cached_meta_indexes)
{
- if (!list_pack_checksums_from_superindex_file (superindex_path, &ret_meta_indexes,
- &ret_data_indexes,
- cancellable, error))
- goto out;
+ ret_meta_indexes = g_ptr_array_ref (priv->cached_meta_indexes);
+ ret_data_indexes = g_ptr_array_ref (priv->cached_content_indexes);
}
else
{
- ret_meta_indexes = g_ptr_array_new_with_free_func ((GDestroyNotify)g_free);
- ret_data_indexes = g_ptr_array_new_with_free_func ((GDestroyNotify)g_free);
+ superindex_path = g_file_get_child (priv->pack_dir, "index");
+
+ if (g_file_query_exists (superindex_path, cancellable))
+ {
+ if (!list_pack_checksums_from_superindex_file (superindex_path, &ret_meta_indexes,
+ &ret_data_indexes,
+ cancellable, error))
+ goto out;
+ }
+ else
+ {
+ ret_meta_indexes = g_ptr_array_new_with_free_func ((GDestroyNotify)g_free);
+ ret_data_indexes = g_ptr_array_new_with_free_func ((GDestroyNotify)g_free);
+ }
+
+ priv->cached_meta_indexes = g_ptr_array_ref (ret_meta_indexes);
+ priv->cached_content_indexes = g_ptr_array_ref (ret_data_indexes);
}
ret = TRUE;
GVariantBuilder *meta_index_content_builder = NULL;
GVariantBuilder *data_index_content_builder = NULL;
+ ot_clear_ptrarray (&priv->cached_meta_indexes);
+ ot_clear_ptrarray (&priv->cached_content_indexes);
+
superindex_path = g_file_get_child (priv->pack_dir, "index");
ot_clear_ptrarray (&pack_indexes);